package com.book.dao.Impl;

import com.book.dao.userDao;
import com.book.pojo.User;


public class userDaoImpl extends baseDao implements userDao {
    @Override
    public int insertUser(User user) {
        String sql = "insert into t_user(id,username,password,email) values(?,?,?,?)";
        return update(sql, user.getId(), user.getUsername(), user.getPassword(), user.getEmail());
    }

    @Override
    public User queryByName(String username) {
        String sql="select * from t_user where username=?";
        return queryForOne(User.class,sql,username);
    }

    @Override
    public User queryByNamePwd(String username, String pwd) {
        String sql = "select * from t_user where username=? and password=?";
        return queryForOne(User.class, sql, username,pwd);
    }
}
